function fn(data){
    if(data.g instanceof Array){
        var html = data.g.map(function(item){
            return `<li>${item.q}</li>`
        }).join("");
        iptText.innerHTML = html;
    }else{
        iptText.innerHTML = '';
    }
}
    
/* 
https://www.baidu.com/sugrec?prod=pc&from=pc_web&wd=2&cb=callback
http://www.baidu.com/sugrec?prod=pc&from=pc_web&wd="+ ipt.value+"&cb=callback
*/
ipt.oninput = function(){
    console.log(ipt.value);
    // var src = "https://www.baidu.com/sugrec?prod=pc&from=pc_web&wd="+ ipt.value + "&cb = callback";
    var src = "https://www.baidu.com/sugrec?prod=pc&from=pc_web&wd="+ ipt.value + "&cb=fn";
    //鍙戦€乯son璇锋眰
    var script = document.createElement("script");
    script.src = src;
    document.body.appendChild(script);
    script.onload = function(){
        this.remove();
    }

    
}

sea.onclick = function(){
    search.style.display = 'block';
}